#ifndef TICKETQUERY_H
#define TICKETQUERY_H

#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QMap>
#include <QtCore/QPair>

class TicketQuery {
public:
    enum SearchType {
        Basic,
        Advanced
    };

    enum Operator {
        OperatorIs,
        OperatorContains,
        OperatorIsNot

    };
    // Rename perhaps
    typedef QPair<Operator, QString> QuerySpec;
    typedef QMap<QString, QuerySpec> QueryFieldMap;

    TicketQuery(const QString &searchStr = "", SearchType searchType = Basic);

    void includeStatus(const QString &status, bool value);
    void addLookupField(const QString &field, Operator op, const QString &value);

    SearchType type() const { return m_type; }
    QueryFieldMap fields() const { return m_fields; }
    QString searchStr() const { return m_searchStr; }
    QString owner() const { return m_owner; }
    QStringList statuses() const { return m_statuses; }

private:
    SearchType m_type;
    QString m_searchStr;
    QString m_owner;
    QStringList m_statuses;
    QueryFieldMap m_fields;
};

#endif // TICKETQUERY_H
